<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="org.windey.server.*" %>
<%@ page import="org.windey.server.database.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>manage Windey server</title>
</head>
<body>
<h1>Manage Windey Server</h1>
<%
WindeyServer server = WindeyServer.getServer();
String action;
if (request.getParameter("action") == null)
{
	action = "";
}
else
{
	action = request.getParameter("action");
}

if (action.equalsIgnoreCase("start"))
{
	server.startServer();
}
else if (action.equalsIgnoreCase("stop"))
{
	server.stopServer();
}

if (!server.isRunning())
{
	out.println("<p>server status : NOT RUNNING</p>");
	out.println("<a href=\"manageServer.jsp?action=start\">Start server</a>");
}
else
{
	out.println("<p>server status : RUNNING</p>");
	out.println("<a href=\"manageServer.jsp?action=stop\">Stop server</a>");
}
%>
</body>
</html>